﻿
namespace NPSoft.Ferrero.Framework.Infrastructure.Data
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data;

    public interface IRepository<T> where T : class,new()
    {
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="info">ModelInfo</param>
        /// <returns>Excute Result</returns>
        int Add(T info);

        /// <summary>
        /// Edit
        /// </summary>
        /// <param name="info">ModelInfo</param>
        /// <returns>Excute Result</returns>
        int Edit(T info);

        /// <summary>
        /// Remove
        /// </summary>
        /// <param name="info">ModelInfo</param>
        /// <returns>Excute Result</returns>
        int Remove(T info);

        /// <summary>
        /// Search
        /// </summary>
        /// <param name="condtion">Where Condtion</param>
        /// <returns>Result List</returns>
        DataSet Search(StringBuilder condtion);

        /// <summary>
        /// Search
        /// </summary>
        /// <param name="condtion">Where Condtion</param>
        /// <returns>Result List</returns>
        ICollection<T> SearchCollection(StringBuilder condtion);

        /// <summary>
        /// Get Model infomation By Id
        /// </summary>
        /// <param name="id">Primary Key</param>
        /// <returns>ModelInfo</returns>
        T GetById(Guid id);

        /// <summary>
        /// Get Model infomation By Id
        /// </summary>
        /// <param name="id">Primary Key</param>
        /// <returns>ModelInfo</returns>
        T GetById(long id);

        /// <summary>
        /// Set Model Infomation by db
        /// </summary>
        /// <param name="row">Data row</param>
        /// <returns>ModelInfo</returns>
        T SetInfo(DataRow row);
    }
}
